home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Diagonal wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.3 KB  |  51 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 2
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6.  
  7. pascal short DiagonalWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* If you make a long enough region starting at the bottomright corner and
  10.    making a strip down and left of <BoxSize> width, all you have to do is move
  11.    the region up until the entire screen is filled.  Dave thinks ideas like
  12.    this should be taken out and shot, but it works. */
  13.    
  14. pascal short DiagonalWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     short            maxmax;
  17.     RgnHandle        archie;
  18.     short            BoxSize;
  19.     Point            zeroPoint;
  20.     
  21.     zeroPoint.h=boundsRect.left;
  22.     zeroPoint.v=boundsRect.top;
  23.     
  24.     BoxSize=theWindowWidth/40;
  25.     
  26.     maxmax=(theWindowWidth>theWindowHeight) ? theWindowWidth : theWindowHeight;
  27.     maxmax+=BoxSize;
  28.     archie=NewRgn();
  29.     OpenRgn();
  30.         MoveTo(boundsRect.right+BoxSize, boundsRect.bottom);
  31.         Line(0,BoxSize);
  32.         Line(-maxmax,maxmax);
  33.         Line(-BoxSize,0);
  34.         Line(maxmax,-maxmax);
  35.     CloseRgn(archie);
  36.  
  37.     do
  38.     {
  39.         StartTiming();
  40.         OffsetRgn(archie,0,-BoxSize);
  41.         CopyBits(&(sourceGrafPtr->portBits),&(destGrafPtr->portBits),
  42.             &boundsRect,&boundsRect,0,archie);
  43.         TimeCorrection(CorrectTime);
  44.     }
  45.     while (!PtInRgn(zeroPoint, archie));
  46.     
  47.     DisposeRgn(archie);
  48.     
  49.     return 0;
  50. }
  51.